<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}DNS管理系统{% endblock %}</title>
    
    {% load static %}
    <!-- Bootstrap 5 CSS -->
    <link href="{% static 'vendor/bootstrap/css/bootstrap.min.css' %}" rel="stylesheet">
    
    <!-- Bootstrap Icons -->
    <link rel="stylesheet" href="{% static 'vendor/bootstrap-icons/bootstrap-icons.css' %}">
    
    <!-- 自定义样式 -->
    <link href="{% static 'css/main.css' %}" rel="stylesheet">
    
    {% block extra_css %}{% endblock %}
</head>
<body class="bg-light">
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-dark bg-primary shadow-sm">
        <div class="container">
            <a class="navbar-brand fw-bold" href="{% url 'home' %}">
                <i class="bi bi-cloud-arrow-up me-2"></i>DNS管理系统
            </a>
            
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav me-auto">
                    {% if user.is_authenticated %}
                        <li class="nav-item">
                            <a class="nav-link" href="{% url 'home' %}">
                                <i class="bi bi-house me-1"></i>仪表盘
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="{% url 'cloud_accounts' %}">
                                <i class="bi bi-cloud-check me-1"></i>云账号
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="{% url 'domains' %}">
                                <i class="bi bi-globe me-1"></i>域名管理
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="{% url 'operation_logs' %}">
                                <i class="bi bi-journal-text me-1"></i>操作日志
                            </a>
                        </li>
                    {% endif %}
                </ul>
                
                <ul class="navbar-nav">
                    {% if user.is_authenticated %}
                        <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown">
                                <i class="bi bi-person-circle me-1"></i>{{ user.username }}
                            </a>
                            <ul class="dropdown-menu">
                                <li><a class="dropdown-item" href="{% url 'admin:index' %}">
                                    <i class="bi bi-gear me-1"></i>管理后台
                                </a></li>
                                <li><hr class="dropdown-divider"></li>
                                <li><a class="dropdown-item" href="{% url 'logout' %}">
                                    <i class="bi bi-box-arrow-right me-1"></i>退出登录
                                </a></li>
                            </ul>
                        </li>
                    {% else %}
                        <li class="nav-item">
                            <a class="nav-link" href="{% url 'login' %}">
                                <i class="bi bi-box-arrow-in-right me-1"></i>登录
                            </a>
                        </li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </nav>

    <!-- 主要内容区域 -->
    <main class="container my-4">
        <!-- 消息提醒 -->
        {% if messages %}
            {% for message in messages %}
                <div class="alert alert-{{ message.tags|default:'info' }} alert-dismissible fade show" role="alert">
                    {% if message.tags == 'error' %}
                        <i class="bi bi-exclamation-triangle me-2"></i>
                    {% elif message.tags == 'success' %}
                        <i class="bi bi-check-circle me-2"></i>
                    {% elif message.tags == 'warning' %}
                        <i class="bi bi-exclamation-circle me-2"></i>
                    {% else %}
                        <i class="bi bi-info-circle me-2"></i>
                    {% endif %}
                    {{ message }}
                    <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
                </div>
            {% endfor %}
        {% endif %}

        <!-- 页面内容 -->
        {% block content %}{% endblock %}
    </main>

    <!-- 页脚 -->
    <footer class="bg-white border-top mt-5">
        <div class="container py-3">
            <div class="row align-items-center">
                <div class="col-md-6">
                    <p class="text-muted mb-0">
                        <i class="bi bi-c-circle me-1"></i>2024 DNS管理系统 - 多云DNS解析管理平台
                    </p>
                </div>
                <div class="col-md-6 text-end">
                    <span class="text-muted">
                        <i class="bi bi-cloud-check text-primary me-1"></i>支持阿里云、腾讯云、华为云、火山引擎
                    </span>
                </div>
            </div>
        </div>
    </footer>

    <!-- Bootstrap 5 JS -->
    <script src="{% static 'vendor/bootstrap/js/bootstrap.bundle.min.js' %}"></script>
    
    <!-- 自定义JavaScript -->
    <script src="{% static 'js/main.js' %}"></script>
    
    {% block extra_js %}{% endblock %}
</body>
</html>